# problems/serializers.py
from rest_framework import serializers
from .models import Problem
from tag.serializers import TagSerializer  # 导入 TagSerializer

class ProblemSerializer(serializers.ModelSerializer):
    tags = TagSerializer(many=True)  # 嵌套标签序列化

    class Meta:
        model = Problem
        fields = ['problem_number', 'problem_name', 'difficulty', 'difficulty_index', 'tags', 'submission_count', 'accepted_count', 'acceptance_rate']
